package com.guoxin.factory.simplefactory.pizzastore.order;

import com.guoxin.factory.simplefactory.pizzastore.pizza.CheesePizza;
import com.guoxin.factory.simplefactory.pizzastore.pizza.GreekPizza;
import com.guoxin.factory.simplefactory.pizzastore.pizza.PepperPizza;
import com.guoxin.factory.simplefactory.pizzastore.pizza.Pizza;

/**
 * 简单工厂
 * 
 * @author Administrator
 *
 */
public class SimpleFactory {

	/**
	 * 根据 type 返回对应的Pizza对象
	 */
	public Pizza createPizza(String type) {
		Pizza pizza;
		switch (type) {
		case "cheese":
			pizza = new CheesePizza("奶酪pizza");
			break;
		case "greek":
			pizza = new GreekPizza("希腊pizza");
			break;
		case "pepper":
			pizza = new PepperPizza("胡椒pizza");
			break;
		default:
			pizza = null;
			break;
		}
		return pizza;
	}
}
